import numpy as np
from functools import reduce


# 定义第一个函数
def add3(input_array):
    return map(lambda x:x+3,input_array)


def mul2(input_array):
    return map(lambda x:x*2,input_array)


def sub5(input_array):
    return map(lambda x:x-5,input_array)


def function_composer(*args):
    return reduce(lambda f,g:lambda x:f(g(x)),args)


if __name__ == '__main__':
    arr = np.array([2,5,4,7])
    print(list(add3(mul2(sub5(arr)))))
    func_composed = function_composer(sub5,mul2,add3)
    print(list(func_composed(arr)))